package com.qf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qf.dao.SetMealMess;
import com.qf.entity.Pagination;
import com.qf.entity.SetMeal;
import com.qf.service.SetMealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(rollbackFor=Exception.class)
@Service
public class SetMealServicempl implements SetMealService {

    @Autowired
    private SetMealMess mess;


    @Override
    public PageInfo<SetMeal> findPageAndName(Pagination pagination) {
        //设置分页参数
        PageHelper.startPage(pagination.getCurrentPage(),pagination.getPageSize());
        //查询
        List<SetMeal> setmeal = mess.findByName(pagination.getQueryString());
        //基于查询结果，返回pageInfo
        return new PageInfo<>(setmeal);
    }
}
